<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*,SiTuQingYou.vo.*,SiTuQingYou.util.*"
    pageEncoding="UTF-8"%>
<%String path = request.getContextPath();%>
<!DOCTYPE html>
<html>
<script type="text/javascript" src="<%=path %>/houtai/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ //全选按钮事件
	$("#checkall").click(function(){
		var flag = $(this).prop("checked");
	    $("input[id=ck]").prop("checked",flag);
	});
});
</script>
<script type="text/javascript">//删除选中事件
   $(document).ready(function(){
	   $("#deleteall").click(function(){
		   var sks = $("input[id=ck]:checked");
		   var cids ="";
		   sks.each(function(){
			   var cid = $(this).attr("cid");
			   cids = cids+"&cid="+cid;
		   });
		   $.ajax({
			  url:"<%=path%>/ScenehomeServlet",
			  type:"post",
			  data:"method=deletescene"+cids,
			  success:function(mes){
					sks.each(function(){
					$(this).parent().parent().remove();
					});
					$("#cnum").html(mes);
					}
		   });
	   });
   });
</script>
<script type="text/javascript">//删除事件
   $(document).ready(function(){
	   $("a[id=deleteall]").click(function(){
		  var id = $(this).attr("aid");
		   var thiss= $(this);
		   $.ajax({
			  url:"<%=path%>/ScenehomeServlet",
			  type:"post",
			  data:"method=deleteone&id="+id,
			  success:function(mes){
					thiss.parent().parent().remove();
					$("#cnum").html(mes);
					}
		   });
	   });
   });
</script>
<script type="text/javascript">  //小按钮决定全选
  $(document).ready(function(){
	  $("input[id=ck]").click(function(){
		   var flag = $(this).prop("checked"); 
		 
		   if(flag==false){
			   $("#checkall").prop("checked",false);
		   }
		   else{
			    var c1 = $("input[id=ck]").length;
			    var c2 = $("input[id=ck]:checked").length;
			    if(c1==c2){
			    	$("#checkall").prop("checked",true);
			    }
			    else{
			    	$("#checkall").prop("checked",false);
			    }
		   }
		  });
	  });
  </script>
	<head>
		<meta charset="UTF-8">
		<title></title>

		<link rel="stylesheet" href="<%=path %>/houtai/res/css/amazeui.min.css">
		<link rel="stylesheet" href="<%=path %>/houtai/res/css/admin.css">
		<link rel="stylesheet" href="<%=path %>/houtai/res/css/app.css">
		
		
		<style type="text/css">
		#kuan{
		 margin:10px;
		 padding: 10px;
		}
		#kuan1{
		width:70px;
		margin:10px;
		 padding: 10px;
		}
		#kuan2{
		width:100px;
		margin:10px;
		 padding: 10px;
		}
		#kuan3{
		width:100px;
		margin:10px;
		 padding: 10px;
		}
		#kuan5{
		width:700px;
		margin:10px;
		 padding: 10px;
		}
		.aa{
		 display: inline-block;
		 width: 30px;
		 height: 30px;
		 background-color: #666;
		 color:#FFF;
		 text-align: center;
		 line-height: 30px;
		 border-radius: 15px;
		 text-decoration: none;
		 }
		#remen{
		padding:10px;
		margin:10px;}
		</style>
	</head>

	<body>

		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">景点管理</strong><small><button type="button" class="am-btn am-btn-default btnAdd">
										<span class="icon-plus"></span> 新增景点     
									</button>
									</small>
									<button type="button" id="newscp">新增景点照片</button></div>
			</div>

			<hr>

			<div class="am-g">
			<input type="checkbox"  id="checkall"  > 全选 
			 <a  id="deleteall" href="javascript:void(0);">删除选中 </a>
				<div class="am-u-sm-12 am-u-md-3">
					<div class="am-input-group am-input-group-sm">
						<form  method="post" action="<%=path%>/houtai/seach.jsp">
						       <input type="text" name="key" >
						        <input type="submit" value="搜索">
						       </form>  
					</div>
				</div>
			</div>

			<div class="am-g" style="margin-top: 5px;">
				<div class="am-u-sm-12">
					<form class="am-form">
				<!-- 景点管理 -->  
				<jsp:include page="../ScenehomeServlet">
				<jsp:param value="allscene" name="method"/>
				</jsp:include>
                 <table><tr><td></td>
                 <td>景点名称</td>
                 <td>景点简介</td>
                 <td>城市</td>
                 <td>分类</td>
                 <td id="remen">热门</td>
                 <td id="remen">得分</td>
                 <td id="remen">操作</td>
                 </tr>
                
                 <%
                 ArrayList<Scene> allscene = (ArrayList<Scene>)request.getAttribute("allscene");
                 Pager pager = (Pager) request.getAttribute("pager");
                 for(Scene scene:allscene){
                	 %>
                	   <tr ><td id="kuan"><input id="ck" type="checkbox"    cid="<%=scene.getId()%>"></td> <td id="kuan"><%=scene.getScenename() %></td><td id="kuan5"><%=scene.getIntro() %></td>
                	 <td id="kuan1"><%=scene.getCity().getCityname() %></td><td id="kuan2"><%=scene.getTheme().getClassname() %></td>
                	<td><%if(scene.isHot()==true){
                		%>  热门 <%
                	} else{
                		%>  非热门 <%
                	}%>
                	 <td><%=scene.getHotscore() %></td>
                	  <td id="kuan3"> <a  id="modify" href="javascript:void(0)" cid="<%=scene.getId()%>">修改</a>
                	  <a  id="deleteall" href="javascript:void(0);" aid="<%=scene.getId()%>">删除 </a></td></tr>
                	 <% }   %>
                	 
                 </table>
                   <%
           for(int i=1;i<=pager.getPageCount();i++)
           {%>
              <a href="<%=path%>/houtai/role.jsp?pageNum=<%=i%>" class="aa"><%=i%></a>
           
          <%}%>
                         共<%=pager.getPageCount() %>页   共<%=pager.getDataCount() %>记录 
					</form> 
				</div>
			</div>
		</div>

		</div>
		<!-- content end -->
		</div>
		</div>

		<!--[if (gte IE 9)|!(IE)]><!-->
		<script src="js/jquery-1.11.3.min.js"></script>
		<!--<![endif]-->
		<script type="text/javascript" src="myplugs/js/plugs.js"></script>
		<script>
			$(function() {

				$(".btnedit").click(function() {

					$.jq_Panel({
						title: "修改角色",
						iframeWidth: 500,
						iframeHeight: 300,
						url: "editRole.html"
					});
				});

				$(".btnAdd").click(function() {
             
					$.jq_Panel({
						title: "添加景点",
						iframeWidth: 600,
						iframeHeight: 300,
						url: "newscene.jsp",
						
					});
				});
				$("#newscp").click(function() {
		             
					$.jq_Panel({
						title: "添加景点照片",
						iframeWidth: 600,
						iframeHeight: 300,
						url: "newscenephoto.jsp",
						
					});
				});
				$("a[id=modify]").click(function() {
					var cid = $(this).attr("cid")
					$.jq_Panel({
						title: "修改景点",
						iframeWidth: 500,
						iframeHeight: 300,
						url: "modify.jsp?cid="+cid
					});

				});
			});

			function sharesysfun(id) {
				location.href = "shareRole.html";
			}
		</script>
	</body>

</html>